/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 * 
 * NewFrame.java
 *
 * Created on 14/04/2013
 *
 **
 * @author Abdel
 */

import java.awt.Dimension;
import java.awt.Toolkit;


public class NewJFrame extends javax.swing.JFrame {

    
    /**
     * Creates new form NewJFrame
     */
    public NewJFrame() {
        super();
       	initComponents();
        setNewFrame();

    }
    
    public NewJFrame(String title) {
        super(title);
       	initComponents();
        setNewFrame();
        
    }
    
    /**
     *
     */
    public final void setNewFrame(){
    
        
        Dimension pantalla = Toolkit.getDefaultToolkit().getScreenSize();
        int height = pantalla.height;
        int width = pantalla.width;
        
        setLocationRelativeTo(null);
        
        //setPreferredSize(new java.awt.Dimension(width/2, height/2));
        setPreferredSize(new java.awt.Dimension( (width - this.getWidth()) / 2, (height - this.getHeight()) / 2 - 20) );
 
        //setSize(width/2, height/2);
        //setSize((width - this.getWidth()) / 2, (height - this.getHeight()) / 2 - 20);
        
        setDefaultCloseOperation(DISPOSE_ON_CLOSE);	

        getContentPane().setBackground(new java.awt.Color(255,255,255));
        //UIManager.put("Button.background", Color.BLUE);
        //UIManager.put("Button.foreground", Color.BLUE);
       
    }
    
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")

    private void initComponents() {

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 300, Short.MAX_VALUE)
        );

        pack();
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */

        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }


        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new NewJFrame("FCB Granada").setVisible(true);
                
            }
        });
    }

}
